package com.crm.customers.dao.impl;

import org.springframework.stereotype.Repository;

import com.crm.base.dao.BaseDao;
import com.crm.customers.dao.ContractUpdateHistoryDao;
import com.crm.customers.model.ContractUpdateHistory;

@Repository("contractUpdateHistoryDao")
public class ContractUpdateHistoryDaoImpl extends BaseDao implements ContractUpdateHistoryDao {

	private static final String MAPPER_NAMESAPCE = "ContractUpdateHistoryMapper.";
	
	@Override
	public ContractUpdateHistory insertHistory(ContractUpdateHistory cuh) {
		insert(MAPPER_NAMESAPCE+"insertHistory", cuh);
		return cuh;
	}

	@Override
	public ContractUpdateHistory getCUHByParams(ContractUpdateHistory cuh) {
		return selectOne(MAPPER_NAMESAPCE+"getCUHByParams", cuh);
	}

	@Override
	public ContractUpdateHistory updateHistory(ContractUpdateHistory cuh) {
		update(MAPPER_NAMESAPCE+"updateHistory", cuh);
		cuh = selectOne(MAPPER_NAMESAPCE+"getCUHByParams", cuh);
		return cuh;
	}

	@Override
	public int checkHistoryIsExist(ContractUpdateHistory cuh) {
		return selectOne(MAPPER_NAMESAPCE+"checkHistoryIsExist", cuh);
	}

}
